﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using WalkingTec.Mvvm.Core;
using System.Text.Json.Serialization;
using Digitalmes.Model;
using Digitalmes.Model.IoTManagement;

namespace Digitalmes.Model.IoTManagement
{
    /// <summary>
    /// 表计参数表
    /// </summary>
	[Table("MeterParameter")]

    [Display(Name = "_Model.MeterParameter")]
    public class MeterParameter : BasePoco,IPersistPoco,ITenant
    {
        [Key]
        [Display(Name = "_Model._MeterParameter._ID")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public new long ID { get; set; }
        [Display(Name = "_Model._MeterParameter._ParamName")]
        [Comment("参数名称")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string ParamName { get; set; }
        [Display(Name = "_Model._MeterParameter._ParameterAddress")]
        [Comment("参数地址")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string ParameterAddress { get; set; }
        [Display(Name = "_Model._MeterParameter._ParamUnit")]
        [Comment("参数单位")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public string ParamUnit { get; set; }
        [Display(Name = "_Model._MeterParameter._Description")]
        [Comment("参数说明")]
        public string Description { get; set; }
        [Display(Name = "_Model._MeterParameter._ParameterDataType")]
        [Comment("数据类型")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public TagDataTypeEnum? ParameterDataType { get; set; }
        [Display(Name = "_Model._MeterParameter._Eanble")]
        [Comment("启用")]
        public bool? Eanble { get; set; }
        [Display(Name = "_Model._MeterParameter._Device")]
        [Comment("设备")]
        public MeterDevice Device { get; set; }
        [Display(Name = "_Model._MeterParameter._Device")]
        [Comment("设备")]
        public long? DeviceId { get; set; }
        [Display(Name = "_Model._MeterDataRecord._Parameter")]
        [InverseProperty("Parameter")]
        public List<MeterDataRecord> MeterDataRecord_Parameter { get; set; }
        [Display(Name = "_Model._MeterParameter._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;
        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

	}

}
